import globals from "globals";
import pluginJs from "@eslint/js";
import babelParse from '@babel/eslint-parser'


/** @type {import('eslint').Linter.Config[]} */
export default [
  {files: ["**/*.js"], languageOptions: {sourceType: "script"}},
  {
    languageOptions: {
      parser: babelParse, // 使用 babel-eslint 解析器
      globals: {
        ...globals.commonjs,
        console: "readonly"
      },
      parserOptions: {
        babelOptions: {
          presets: ["@babel/preset-env"],
          plugins: [
            // 启用装饰器支持
            ["@babel/plugin-proposal-decorators", { legacy: true }],
          ],
        },
      }
    },
    rules: {
      "no-console": "off",
      "node/no-unsupported-features/es-syntax": "off",
      "no-unused-vars": "error",
      "eqeqeq": "error",  // 强制使用 === 而不是 ==
    },
  },
  pluginJs.configs.recommended,
];